<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    request.setAttribute("basePath", basePath);
%>
<!DOCTYPE html>  
<html>  
<head>  
<meta charset="utf-8">  
<title>上传图片</title>  
<script type="text/javascript">
	var msg = "${msg}";
	if(msg){
		if(msg=="1"){
			alert("上传成功！")
		}else if(msg=="-1"){
			alert("上传失败！请上传zip文件！");
		}else if(msg=="-2"){
			alert("上传失败！出现错误！");
		}else if(msg=="-3"){
			alert("上传失败！请选择上传的文件！");
		}
	} 
	function sub (){
		var btn = document.getElementById("subBtn");
		var f = document.getElementById("file");
		var tip = document.getElementById("tip");
		btn.style.display="none";
		f.style.display="none";
		tip.style.display="block";
		return true;
	}
	function fileChange(target){
	 var name=target.value;  
      var fileName = name.substring(name.lastIndexOf(".")+1).toLowerCase();  
      if(fileName !="zip" ){  
          alert("请选择zip格式文件上传！");  
          target.value="";  
          return  
      }  
	}
	

</script>
</head>  
<body>  
<form action="<%=basePath %>s/upload" method="post" enctype="multipart/form-data" onsubmit="return sub()" >  
<input id ="file" type="file" name="file"  onchange="fileChange(this);" /> <input id="subBtn" type="submit" value="上传" /></form>  
<div id="tip" style="display:none;">文件上传中请稍等。。。</div>
</body>  
</html>  